package dao.jpa;

import java.io.Serializable;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import dao.TransacaoDAO;
import entity.Conta;
import entity.Transacao;

@Repository
public class TransacaoJpaDAO extends GenericJpaDAO<Transacao> implements
		TransacaoDAO, Serializable {

	private static final long serialVersionUID = -7804171767303238591L;

	@SuppressWarnings("unchecked")
	@Override
	public List<Transacao> listarTransacoesPorConta(Conta conta) {

		final Criteria criteria = criarCriteria();
		criteria.add(Restrictions.eq("conta", conta));

		return criteria.list();
	}

}
